import {
	http
} from '@/utils/request/index.js';
// 获取首页数据
export const reqHomeData = () => http.get('/homedata');
// 获取分类信息
export const reqCateData = () => http.get('/cate');
// 获取更多商品列表
export const reqMoreList = () => http.get('/order/moreList');
// 根据id获取商品详情
export const reqGoodsDetailByid = (_id) => http.get(`/goods/detail?_id=${_id}`);
// 根据搜索关键字获取商品列表
export const reqSearch = (kw) => http.post('/search', {
	kw
});
// 获取购物车商品数量
export const reqCartCount = (user_id) => http.get(`/cart/count?user_id=${user_id}`);
// 获取购物车商品列表
export const reqCartGoodsList = (user_id) => http.get(`/cart/goodslist?user_id=${user_id}`);
// 将商品加入购物车
export const reqCartAddGoods = (data) => http.post('/cart/addgoods', data);
// 更改购物车单个商品选中状态
export const reqCartCheckedOne = (_id, checked) => http.post('/cart/onechecked', {
	_id,
	checked
});
// 更改购物车多个商品选中状态
export const reqCartCheckedAll = (user_id, checked) => http.post('/cart/allchecked', {
	user_id,
	checked
});
// 删除购物车选中商品
export const reqDelGoods = (delArr) => http.post('/cart/delgoods', {
	delArr
});
// 根据id修改购物车商品数量
export const reqCartModCount = (_id, buy_num) => http.post('/cart/modcount', {
	_id,
	buy_num
});
// 修改购物车商品规格
export const reqCartModSize = (data) => http.post('/cart/modsize', data);
// 登录
export const reqLogin = (code) => http.post('/login', {
	code
});
// 获取收货信息列表
export const reqCneeList = (user_id) => http.get(`/cnee/getdata?user_id=${user_id}`);
// 更新收货信息
export const reqUploadCnee = (user_id, formData) => http.post('/cnee/upload', {
	user_id,
	formData
});
// 根据id删除收货信息
export const reqDeleteCnee = (_id) => http.post('/cnee/delete', {
	_id
});
// 提交订单
export const reqSubmitOrder = (data) => http.post('/order/submit', data);
// 获取全部订单
export const reqOrderData = (user_id) => http.get(`/order/getdata?user_id=${user_id}`);
// 根据订单号删除订单
export const reqDelOrder = (_id) => http.post('/order/delele', {
	_id
});
// 获取待付款订单数量
export const reqOrderCount = (user_id) => http.get(`/order/count?user_id=${user_id}`);
// 获取用户信息
export const reqUserInfo = (user_id) => http.get(`/user/getinfo?user_id=${user_id}`);
// 更新用户性别
export const reqUploadSex = (_id, gender) => http.post('/user/upsex', {
	_id,
	gender
});
// 更新用户生日
export const reqUploadDay = (_id, birthday) => http.post('/user/upday', {
	_id,
	birthday
});
// 更新用户姓名
export const reqUploadName = (_id, name) => http.post('/user/upname', {
	_id,
	name
})
// 更新用户头像
export const reqUploadAvatar = (_id, avatar) => http.post('/user/upavatar', {
	_id,
	avatar
})
// 同时更换头像昵称
export const reqUploadNicImg = (_id, avatar, nickName) => http.post('/user/upnicimg', {
	_id,
	avatar,
	nickName,
})
